package cn.o.api.feign.controller;

import cn.o.entity.base.Parameter;
import cn.o.entity.base.Result;
import cn.o.api.feign.service.FeignService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Description:
 * @Author: Zhou Chenyu
 * @Date: 2018/10/26
 * @Version: V1.0
 * @Modified By:
 * @Modified Date:
 * @Why:
 */
public abstract class FeignController<T> {

    public abstract FeignService getService();

    @RequestMapping(value = "/create")
    public Result<T> create(T t) {
        return this.getService().create(t);
    }

    @RequestMapping(value = "/update")
    public Result<T> update(T t) {
        return this.getService().update(t);
    }

    @RequestMapping(value = "/delete")
    public Result<T> delete(String id) {
        return this.getService().delete(id);
    }

    @RequestMapping(value = "/get")
    public Result<T> get(String id) {
        return this.getService().get(id);
    }

    @RequestMapping(value = "/list")
    public Result<T> list(@RequestBody Parameter parameter) {
        return this.getService().list(parameter);
    }

    @RequestMapping(value = "/list_by_page")
    public Result<T> listByPage(@RequestBody Parameter parameter) {
        return this.getService().listByPage(parameter);
    }
}
